/**
 * 通用侧边栏样式
 * 适用于所有使用侧边栏导航的页面
 */

/* 侧边栏基础样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* 侧边栏头部 */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo span[data-icon] {
    margin-right: 0.75rem;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--dark-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 导航菜单 */
.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-nav ul li {
    margin-bottom: 0.25rem;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--dark-color);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav ul li a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-nav ul li.active a {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-nav ul li a span[data-icon] {
    margin-right: 0.75rem;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.logout-btn {
    display: flex;
    align-items: center;
    color: var(--danger-color);
    transition: opacity 0.2s;
}

.logout-btn:hover {
    opacity: 0.8;
}

.logout-btn span[data-icon] {
    margin-right: 0.75rem;
}

/* 主内容区响应式调整 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* 折叠侧边栏样式 */
.sidebar-nav ul li a span:not([data-icon]),
.sidebar-footer .logout-btn span:not([data-icon]) {
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .logo span:not([data-icon]),
.sidebar.collapsed .sidebar-nav ul li a span:not([data-icon]),
.sidebar.collapsed .sidebar-footer .logout-btn span:not([data-icon]) {
    display: none;
    opacity: 0;
}

.sidebar.collapsed .sidebar-nav ul li a {
    padding: 0.75rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-nav ul li a span[data-icon] {
    margin-right: 0;
}

.sidebar.collapsed .logo {
    justify-content: center;
}

.sidebar.collapsed .logo span[data-icon] {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-footer .logout-btn {
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer .logout-btn span[data-icon] {
    margin-right: 0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar .logo span:not([data-icon]),
    .sidebar .sidebar-nav ul li a span:not([data-icon]),
    .sidebar .sidebar-footer .logout-btn span:not([data-icon]) {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
} 